import React, {Component} from 'react';
import {render, getModel} from 'react-division';
import {Input} from 'antd';


export default (modelName, index, key) => {
    return render({
        models: [
            [modelName, 'data', index, key]
        ]
    })(class extends Component{
        constructor(props) {
            super(props);
        }
        render() {
            const {index, colKey, onChange, onFocus} = this.props;
            const modelData = this.props[modelName];
            let value = modelData.data[index][colKey];
            
            return (
                <Input
                    value={value}
                    onChange={onChange}
                    key={colKey + index}
                    onFocus={onFocus}
                />
            )
        }
    });
}